package com.suixingfu.controller;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.multipart.MultipartFile;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.suixingfu.dao.*;
import com.suixingfu.service.ChaXunYuE;
import com.suixingfu.service.DaiFuCaiWuChaXun;
import com.suixingfu.service.DaiFuChaXun;
import com.suixingfu.service.FeiLvChaXun;
import com.suixingfu.service.FuKuan;
import com.suixingfu.utils.Des;
import com.suixingfu.utils.FileUploadUtils;
import com.suixingfu.utils.Md5;
import com.suixingfu.utils.PublicPartUtils;
import com.suixingfu.utils.UploadPathUtils;
import com.suixingfu.vo.FukuanVo;
import com.suixingfu.vo.UserVo;

@Controller
public class IndexController {
	
	@Autowired
	private FukuanDao fukuandao;
	@Autowired
	private UserDao userdao;
	int i=1;
	
//	public IndexController(){
//		HttpSession session = null;
//		String uname=(String) session.getAttribute("uname");
//		System.out.println("uuu="+uname);
//		if(uname==""||uname==null){
//			return;
//		}
//	}

	public FukuanDao getFukuandao() {
		return fukuandao;
	}
	public void setFukuandao(FukuanDao fukuandao) {
		this.fukuandao = fukuandao;
	}
	public UserDao getUserdao() {
		return userdao;
	}
	public void setUserdao(UserDao userdao) {
		this.userdao = userdao;
	}


	//格式化时间
	static SimpleDateFormat formatter=new SimpleDateFormat("yyyyMMddHHmmss");
	static Date curDate=new Date(System.currentTimeMillis());//获取当前时间
	static String formatDate=formatter.format(curDate);
	

	
	//跳转到主页面
	@RequestMapping("/index")
	public String index(){
		return "view/index/index";
	}
	
	//单笔付款申请页面
	@RequestMapping("/danbifukuan")
	public String danbifukuan(){
		return "view/index/danbifukuan";
	}
	
	//单笔付款申请页面
	@RequestMapping("/piliangfukuan")
	public String piliangfukuan(){
		return "view/index/piliangfukuan";
	}
	
	//代付交易查询页面
	@RequestMapping("/daifujiaoyichaxun")
	public String daifujiaoyichaxun(){
		return "view/index/daifujiaoyichaxun";
	}
	
	//账务查询页面
	@RequestMapping("/zhangwuchaxun")
	public String zhangwuchaxun(){
		return "view/index/zhangwuchaxun";
	}

	//余额查询页面
	@RequestMapping("/yuechaxun")
	public String yuechaxun(){
		return "view/index/yuechaxun";
	}

	//商户状态查询页面
	@RequestMapping("/clientstatus")
	public String clientstatus(){
		return "view/index/clientstatus";
	}
	
	//点击单笔付款申请--付款交易
	@RequestMapping(value="/danbiAjax",method=RequestMethod.POST)
	@ResponseBody
	public JSONObject danbiAjax(Model model,@RequestParam("params")String params,@RequestParam("paytyp")String paytyp) throws Exception{	
		
		System.out.println("params="+params);
		//解密
        String p = new Des().strDec(params, "1", "2", "3");
		System.out.println("p="+p);
		
		JSONObject paramObject=JSONObject.parseObject(p);//转换为对象
		List paramList=new ArrayList();
		paramList.add(paramObject);
		JSONArray paramArray=new JSONArray(paramList);
		
		//payItem之前
		Map<String,Object> payItemMap=new HashMap<String,Object>();
		payItemMap.put("clientId", "600000000000182");
		payItemMap.put("payTyp", paytyp);
		payItemMap.put("totalPayCount", 1);
		payItemMap.put("totalPayAmt", paramObject.getFloat("payAmt"));
		payItemMap.put("payItems", paramArray);
		JSONObject payItemObject=new JSONObject(payItemMap);
		System.out.println("payItemObject="+payItemObject+",payTyp="+payItemObject.getString("payTyp"));
		
		//reqData之前
		Map<String,Object> reqDataMap=new HashMap<String,Object>();
		reqDataMap.put("clientId", "600000000000182");
//		reqDataMap.put("clientId", "");
		reqDataMap.put("version", "1.0");
		reqDataMap.put("reqId", formatDate+"10"+numFormat(i));
		reqDataMap.put("tranCd", "DF1003");
		reqDataMap.put("reqData", payItemObject);
		JSONObject req_json=new JSONObject(reqDataMap);
		System.out.println("req_array="+req_json);
		System.out.println("formatDate="+formatDate+",reqId="+formatDate+"10"+numFormat(i));
		
//		System.out.println("req_json.getString()="+req_json.getString("reqData"));
		
		
		//付款申请
		String fukuanJson=FuKuan.getfukuan(req_json);
		System.out.println("fukuanJson="+fukuanJson);
		JSONObject fukuan=JSONObject.parseObject(fukuanJson);//转换为对象
		System.out.println("fukuan="+fukuan);
//		String resData_json=(String) fukuan.get("resData");
//		JSONObject resData = JSONObject.parseObject(resData_json);//？？
		
		//存入数据库
		DatabaseDao.insertIntoDatabase(fukuandao, req_json, fukuan, params, 1);
		
		model.addAttribute("fukuan", fukuan);
//		model.addAttribute("resData", resData_json);
		i++;
		return fukuan;
	}
	
	//判断付款密码是否正确，是否设置
	@RequestMapping(value="/judgeFkPswExist",method=RequestMethod.POST)
	@ResponseBody
	public int judgeFkPswExist(@RequestParam("fkPsw")String fkPsw) throws Exception{
//		System.out.println("fkPsw="+fkPsw);
//		String md5Psw=Md5.getMD5(("20160909S.x.f").getBytes());
//		System.out.println("md5Psw="+md5Psw);
//		boolean flag=md5Psw.equals(fkPsw);
//		if(flag==false){//付款密码为空
//			return 2;
//		}else{//正确
//			return 0;
//		}
		
		UserVo uservo=userdao.select("600000000000182");
		System.out.println("fukuanpsw="+uservo.getFukuanPsw());
		boolean flag=fkPsw.equals(uservo.getFukuanPsw());
		if(uservo.getFukuanPsw()==null){//付款密码为空
			return 1;
		}else if(flag==false){//付款密码不正确
			return 2;
		}else{//正确
			return 0;
		}
	}
	
	//设置付款登录密码
	@RequestMapping(value="/setFukuanPsw",method=RequestMethod.POST)
	@ResponseBody
	public int setFukuanPsw(@RequestParam("fkPsw")String fkPsw,UserVo uservo) throws Exception{
		uservo.setFukuanPsw(fkPsw);
		uservo.setClientId("600000000000182");
		int fkvo_update=userdao.update(uservo);
		System.out.println("fkvo_update="+fkvo_update);
		return fkvo_update;
		
	}
	
	//批量付款申请--点击上传--显示excel信息
	@RequestMapping(value="/piliangUpload",method=RequestMethod.POST)
	@ResponseBody
	public JSONObject piliangUpload(Model model,@RequestParam(value="uploadfile")MultipartFile file,HttpServletRequest request) throws Exception{	
		
		String fos=UploadPathUtils.uploadPath(file, request);
		System.out.println("fos="+fos);
		JSONObject getexcelfile=getExcelFile(fos);
		
		System.out.println("getexcelfile="+getexcelfile);
		return getexcelfile;
		

	}
	
	//点击批量付款申请--付款交易--点击提交
	@RequestMapping(value="/piliangHandler",method=RequestMethod.POST)
	@ResponseBody
	public String piliangHandler(Model model,@RequestParam(value="uploadfile")MultipartFile file,HttpServletRequest request) throws Exception{	
		
		String filepath=UploadPathUtils.uploadPath(file, request);
		String getexcelfile=excelGetFukuan(filepath);
		
		System.out.println("getexcelfile="+getexcelfile);
//		model.addAttribute("resData", resData);
		return getexcelfile;
		

	}
	
	
	//点击账务查询--代付账务流水查询
	@RequestMapping("/zhangwuHandler")
	public String zhangwuHandler(Model model) throws Exception{
		SimpleDateFormat formatter=new SimpleDateFormat("yyyyMMdd");
		Date date=new Date(System.currentTimeMillis());//获取当前时间
		String jzFormatDate=formatter.format(date);//格式化时间
		
		JSONObject resData=zhangwuPublic(jzFormatDate);
		model.addAttribute("resData", resData);
		return "forward:/zhangwuchaxun";
		
	}
	
	//账务查询--点击查询结账日期
	@RequestMapping(value="/zhangwuAjax",method=RequestMethod.GET)
	public String zhangwuAjax(@RequestParam("jzdate")String jzDate,Model model) throws UnsupportedEncodingException, Exception{

		SimpleDateFormat formatter=new SimpleDateFormat("yyyyMMdd");
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		
		Date date=sdf.parse(jzDate);
		String jzFormatDate=formatter.format(date);//格式化时间
		System.out.println("jzDate="+date+",jzFormatDate="+jzFormatDate);
		
		JSONObject resData=zhangwuPublic(jzFormatDate);
		
		model.addAttribute("resData", resData);
//		return resData.getJSONArray("resAccDtlResultList");
		return "forward:/zhangwuchaxun";
		
	}
	
	//账务查询公共
	public static JSONObject zhangwuPublic(String jzFormatDate) throws UnsupportedEncodingException, Exception{
		Map<String,Object> reqMap=new HashMap<String,Object>();
		reqMap.put("acDate", jzFormatDate);//结账日期
		reqMap.put("pageSize", 100);//每页数量
		reqMap.put("pageNumber", 1);//第几页
		JSONObject req_json=new JSONObject(reqMap);
		System.out.println("req_json="+req_json);
		
		Map<String,Object> zhangwuMap=new HashMap<String,Object>();
		zhangwuMap.put("clientId", "600000000000182");
		zhangwuMap.put("version", "1.0");
		zhangwuMap.put("reqId", formatDate+"10001");
		zhangwuMap.put("tranCd", "DF1006");
		zhangwuMap.put("reqData", req_json);
		JSONObject zhangwu_json=new JSONObject(zhangwuMap);
		System.out.println("zhangwu_json="+zhangwu_json);
		
		String zhangwuJson=DaiFuCaiWuChaXun.getZhangWuAjax(zhangwu_json);//查询结果
		JSONObject zhangwu=JSONObject.parseObject(zhangwuJson);//转换为对象
		System.out.println("zhangwuJson="+zhangwuJson);
		
		String resData_json=(String) zhangwu.get("resData");
		System.out.println("AjaxresData_json="+resData_json);
		JSONObject resData = JSONObject.parseObject(resData_json);
		System.out.println("AjaxresData_json="+resData_json);
			
		return resData;
	}
	
	//点击代付交易查询--代付结算流水查询
	@RequestMapping("/daifujiaoyiHandler")
	public String daifujiaoyiHandler(Model model) throws Exception{
		SimpleDateFormat formatter=new SimpleDateFormat("yyyyMMdd");
		Date date=new Date(System.currentTimeMillis());//获取当前时间
		String startFormatDate=formatter.format(date);//格式化时间
		
		JSONObject resData=daifujiaoyiPublic(startFormatDate);
		model.addAttribute("resData", resData);
//			return resData.getJSONArray("resAccDtlResultList");
		return "forward:/daifujiaoyichaxun";
	}
	
	//点击代付交易查询--代付结算流水查询
	@RequestMapping(value="/daifujiaoyiAjax",method=RequestMethod.GET)
	public String daifujiaoyiAjax(@RequestParam("jyStartDate")String jyStartDate,Model model) throws UnsupportedEncodingException, Exception{
		
		SimpleDateFormat formatter=new SimpleDateFormat("yyyyMMdd");
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		
		Date startdate=sdf.parse(jyStartDate);
//		Date enddate=sdf.parse(jyEndDate);
		String startFormatDate=formatter.format(startdate);//格式化时间
//		String endFormatDate=formatter.format(enddate);//格式化时间
		System.out.println("startFormatDate="+startFormatDate);
		
		JSONObject resData=daifujiaoyiPublic(startFormatDate);
		model.addAttribute("resData", resData);
		return "forward:/daifujiaoyichaxun";
	}
	
	//代付交易公共
	public static JSONObject daifujiaoyiPublic(String startFormatDate) throws UnsupportedEncodingException, Exception{
		Map<String,Object> reqMap=new HashMap<String,Object>();
		reqMap.put("stDate", startFormatDate);//结账日期
		reqMap.put("pageSize", 100);//每页数量
		reqMap.put("pageNumber", 1);//第几页
		JSONObject req_json=new JSONObject(reqMap);
		System.out.println("req_json="+req_json);
		
		Map<String,Object> zhangwuMap=new HashMap<String,Object>();
		zhangwuMap.put("clientId", "600000000000182");
		zhangwuMap.put("version", "1.0");
		zhangwuMap.put("reqId", formatDate+"10001");
		zhangwuMap.put("tranCd", "DF1005");
		zhangwuMap.put("reqData", req_json);
		JSONObject zhangwu_json=new JSONObject(zhangwuMap);
		System.out.println("zhangwu_json="+zhangwu_json);
		
		String daifuJson=DaiFuChaXun.getDaifuJiaoyiAjax(zhangwu_json);//查询结果
		JSONObject daifu=JSONObject.parseObject(daifuJson);//转换为对象
		System.out.println("daifuJson="+daifuJson);
		
		String resData_json=(String) daifu.get("resData");
		JSONObject resData = JSONObject.parseObject(resData_json);
		System.out.println("resData_json_daifu="+resData_json);
		
		return resData;
//			return resData.getJSONArray("resAccDtlResultList");
	}
	
	//点击查询余额,返回结果到页面
	@RequestMapping("/yueHandler")
	public String yueHandler(Model model) throws Exception{
		Map<String,Object> yueMap=new HashMap<String,Object>();
		yueMap.put("clientId", "600000000000182");
		yueMap.put("version", "1.0");
		yueMap.put("reqId", formatDate+"10001");
		yueMap.put("tranCd", "DF1001");
		yueMap.put("reqData", "{}");
		JSONObject yue_json=new JSONObject(yueMap);
		System.out.println("yue_json="+yue_json);
		
		String yueJson=ChaXunYuE.getYueJson(yue_json);//查询结果
		JSONObject yue=JSONObject.parseObject(yueJson);//转换为对象
		
		String resData_json=(String) yue.get("resData");
		JSONObject resData = JSONObject.parseObject(resData_json);
		
		model.addAttribute("yue", yue);
		model.addAttribute("resData", resData);
		return "forward:/yuechaxun";
	}
	
	//点击商户状态查询,返回结果到页面
	@RequestMapping("/clientstatusHandler")
	public String clientstatusHandler(Model model) throws Exception{
		Map<String,Object> feilvMap=new HashMap<String,Object>();
		feilvMap.put("clientId", "600000000000182");
		feilvMap.put("version", "1.0");
		feilvMap.put("reqId", formatDate+"10001");
		feilvMap.put("tranCd", "DF1002");
		feilvMap.put("reqData", "{}");
		JSONObject feilv_json=new JSONObject(feilvMap);
		System.out.println("feilv_json="+feilv_json);
		
		String feilvJson=FeiLvChaXun.getFeiLvAjax(feilv_json);
		JSONObject feilv=JSONObject.parseObject(feilvJson);//转换为对象
		System.out.println("feilv="+feilv);
		
		String resData_json=(String) feilv.get("resData");
		JSONObject resData = JSONObject.parseObject(resData_json);
		System.out.println("resData="+resData);
		
		model.addAttribute("resData", resData);
		return "forward:/clientstatus";
	}
	
	//批量
	public static JSONObject piliang_map(JSONArray paramArray,int totalPayCount,float totalAmt,String payTyp,String clientId) throws Exception{	
		
		//payItem之前
		Map<String,Object> payItemMap=new HashMap<String,Object>();
		payItemMap.put("clientId", clientId);
		payItemMap.put("payTyp", payTyp);
		payItemMap.put("totalPayCount", totalPayCount);
		payItemMap.put("totalPayAmt", totalAmt);
		payItemMap.put("payItems", paramArray);
		JSONObject payItemObject=new JSONObject(payItemMap);
//		System.out.println("payItemObject="+payItemObject+",payTyp="+payItemObject.getString("payTyp"));
		
		//reqData之前
		Map<String,Object> reqDataMap=new HashMap<String,Object>();
		reqDataMap.put("clientId", "600000000000182");
		reqDataMap.put("version", "1.0");
		reqDataMap.put("reqId", formatDate+"10001");
		reqDataMap.put("tranCd", "DF1003");
		reqDataMap.put("reqData", payItemObject);
		JSONObject req_json=new JSONObject(reqDataMap);
		System.out.println("piliang_map_req_array="+req_json);
		return req_json;
	}
	
	//数字格式化
	public static String numFormat(int num){
	    if(num>0&&num<10){
	    	return String.format("%03d", num);   
	    }
	    else if(num>9&&num<100){
	    	return String.format("%02d", num);   
	    }
	    else{
	        return num+"";
	    }
	}
	
	//批量付款--excel文件
	public String excelGetFukuan(String fos) throws UnsupportedEncodingException, Exception{
		JSONObject o=getExcelFile(fos);
		System.out.println("o="+o);
		String fukuanJson=FuKuan.getfukuan(o);
		JSONObject fukuan=JSONObject.parseObject(fukuanJson);//转换为对象
		System.out.println("fukuanJson="+fukuanJson);
		
		//存入数据库
		String resData_json=o.getString("reqData");
		JSONObject resData = JSONObject.parseObject(resData_json);
		
		System.out.println("resData_json="+resData_json);
		DatabaseDao.insertIntoDatabase(fukuandao, o, fukuan, resData.getString("payItems"), 0);
				
		return fukuanJson;
	}
	
	//批量--打开excel文件
	public JSONObject getExcelFile(String fos) throws Exception{
		XSSFWorkbook xssfWorkbook = new XSSFWorkbook(new FileInputStream(fos));
		XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(0);
		int totalPayCount=xssfSheet.getLastRowNum();//总行数--总笔数
		
		String payTyp="";
//		String actTyp="";
//		String smsFlg="";
		
//		System.out.println("totalPayCount="+totalPayCount);
		List paramList=new ArrayList();
		float totalAmt=0;
		//循环行Row
		for(int rowNum = 1; rowNum <= xssfSheet.getLastRowNum(); rowNum++ ){
	        XSSFRow xssfRow = xssfSheet.getRow(rowNum);//行
	        
	     // 循环列Cell    
	        for(int cellNum = 0; cellNum <= xssfRow.getLastCellNum(); cellNum++){  
	        	XSSFCell xssfCell = xssfRow.getCell( cellNum);  
	          if(xssfCell == null){  
	            continue;  
	          } 
	          if(xssfRow.getCell(cellNum)!=null){//处理函数单元格问题，先将单元格内容转为String
	        	  xssfRow.getCell(cellNum).setCellType(xssfCell.CELL_TYPE_STRING);
	         }
	        }  
	        
	        if(xssfRow !=null){
	        	//获取表格中的值
//	        	XSSFCell actnm_xsl =xssfRow.getCell(0);//列
//	        	XSSFCell acttyp_xsl =xssfRow.getCell(1);
//	        	XSSFCell actno_xsl =xssfRow.getCell(2);
//	        	XSSFCell bnknm_xsl =xssfRow.getCell(3);
//	        	XSSFCell lbnknm_xsl =xssfRow.getCell(4);
//	        	XSSFCell payamt_xsl =xssfRow.getCell(5);
//	        	XSSFCell smsflg_xsl =xssfRow.getCell(6);
//	        	XSSFCell tel_xsl =xssfRow.getCell(7);
//	        	XSSFCell purpose_xsl =xssfRow.getCell(8);
//	        	XSSFCell rmk_xsl =xssfRow.getCell(9);
	        	
	        	XSSFCell paytyp_xsl =xssfRow.getCell(0);//列
	        	XSSFCell payamt_xsl =xssfRow.getCell(1);
	        	XSSFCell actnm_xsl =xssfRow.getCell(2);
	        	XSSFCell actno_xsl =xssfRow.getCell(3);
	        	XSSFCell acttyp_xsl =xssfRow.getCell(4);
	        	XSSFCell bnkcd_xsl =xssfRow.getCell(5);
	        	XSSFCell bnknm_xsl =xssfRow.getCell(6);
	        	XSSFCell lbnkno_xsl =xssfRow.getCell(7);
	        	XSSFCell lbnknm_xsl =xssfRow.getCell(8);
	        	XSSFCell smsflg_xsl =xssfRow.getCell(9);
	        	XSSFCell tel_xsl =xssfRow.getCell(10);
	        	XSSFCell purpose_xsl =xssfRow.getCell(11);
//	        	XSSFCell rmk_xsl =xssfRow.getCell(12);
	        	
	        	//得到每一列的值不管是什么类型都转换成字符串
	        	payTyp = paytyp_xsl.getRichStringCellValue().getString();
	        	String bnkCd = bnkcd_xsl.getRichStringCellValue().getString();
	        	String lbnkNo = lbnkno_xsl.getRichStringCellValue().getString();
	        	String actNm = actnm_xsl.getRichStringCellValue().getString();
	        	String actTyp = acttyp_xsl.getRichStringCellValue().getString();
//	        	if(acttyp_str=="对公"){
//	        		actTyp="00";
//	        	}else{
//	        		actTyp="01";
//	        	}
	        	String actNo_kongge = actno_xsl.getRichStringCellValue().getString();
	        	String actNo=actNo_kongge.replace(" ", "");
	        	String bnkNm = bnknm_xsl.getRichStringCellValue().getString();
	        	String lbnkNm = lbnknm_xsl.getRichStringCellValue().getString();
	        	
	        	String payAmt = payamt_xsl.getRichStringCellValue().getString();
	        	float payamt_int=Float.parseFloat(payAmt);
	        	totalAmt+=payamt_int;//总金额
	        	String smsFlg = smsflg_xsl.getRichStringCellValue().getString();
//	        	if(smsFlg_str=="是"){
//	        		smsFlg="1";
//	        	}else{
//	        		smsFlg="0";
//	        	}
	        	String tel = tel_xsl.getRichStringCellValue().getString();
	        	String bankPayPurpose = purpose_xsl.getRichStringCellValue().getString();
//	        	String rmk = rmk_xsl.getRichStringCellValue().getString();
	        	String rmk = "";
	        	
	        	String payItemId=formatDate+"11"+numFormat(rowNum)+"";
	        	String seqNo=rowNum+"";
//	        	String bnkCd="";
//	        	String lbnkNo="";
	        	
	        	Map<String,Object> payItemMap=new HashMap<String,Object>();
	        	payItemMap.put("payItemId", payItemId);
	        	payItemMap.put("seqNo", seqNo);
	        	payItemMap.put("payAmt", payAmt);
	        	payItemMap.put("actNm", actNm);
	        	payItemMap.put("actNo", actNo);
	        	payItemMap.put("actTyp", actTyp);
	        	payItemMap.put("bnkCd", bnkCd);
	        	payItemMap.put("bnkNm", bnkNm);
	        	payItemMap.put("lbnkNo", lbnkNo);
	        	payItemMap.put("lbnkNm", lbnkNm);
	        	payItemMap.put("rmk", rmk);
	        	payItemMap.put("smsFlg", smsFlg);
	        	payItemMap.put("tel", tel);
	        	payItemMap.put("bankPayPurpose", bankPayPurpose);
	    		JSONObject payItem_json=new JSONObject(payItemMap);
//	    		System.out.println("payItem_json="+payItem_json);
	
	    		paramList.add(payItem_json);
	        	
	        }
	        
		}
		String clientId="600000000000182";
		JSONArray paramArray=new JSONArray(paramList);
		JSONObject o=piliang_map(paramArray, totalPayCount, totalAmt,payTyp,clientId);
//		String fukuanJson=FuKuan.getfukuan(o);
//		System.out.println("fukuanJson="+fukuanJson);
		return o;
	}
	
	
	
	public static void main(String[] args){
		
	}

}
